1、青蛙跳台阶：
class Solution {
public:
    int numWays(int n) {
        if(n<=1)
            return 1;
        int dp[n+1];
        dp[1]=1;
        dp[0]=1;
        for(int i=2;i<n+1;i++)      //将数据都放到数组中，避免了一直求f(i)的值
        {
            dp[i]=(dp[i-1]+dp[i-2])%1000000007;
        }
        return dp[n];
    }
};

2、队列的最大值：
class MaxQueue {
public:

    MaxQueue() {

    }
    
    int max_value() {
        return d.empty()?-1:d.front();
    }
    
    void push_back(int value) {
        while(!d.empty()&&d.back()<value)
        {
            d.pop_back();
        }
        q.push(value);
        d.push_back(value);
    }
    
    int pop_front() {
        if(q.empty())
        {
            return -1;
        }
        int front=q.front();
        if(front==d.front())
        {
            d.pop_front();
        }
        q.pop();
        return front;
    }
private:
    deque<int> d;
    queue<int> q;
};

/**
 * Your MaxQueue object will be instantiated and called as such:
 * MaxQueue* obj = new MaxQueue();
 * int param_1 = obj->max_value();
 * obj->push_back(value);
 * int param_3 = obj->pop_front();
 */